#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int n, k;
const int N = 1e5 + 10;
int arr[N];
bool st[N];
int sum;
int count1;
int m1;
int flag;
void dfs()
{
	if (sum > k) {
		flag = 1;
		return;
	}
	for (int i = 0; i < n; i++) {
		if (st[i] == 1) {
			arr[i] *= 2;
			sum += arr[i];
			count1++;
			dfs();
			sum -= arr[i];
			count1--;
			if (flag) {
				//cout << count1 << endl;
				m1 = max(m1, count1);
				flag = 0;
			}
		}
		else {
			st[i] = 1;
			sum += arr[i];
			count1++;
			dfs();
			sum -= arr[i];
			count1--;
			if (flag) {
				m1 = max(m1, count1);
				flag = 0;
			}
		}
	}
}
int main()
{
	cin >> n >> k;
	int ma = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		if (arr[i] > ma) {
			ma = arr[i];
		}
	}
	sort(arr, arr + n);
	if (ma == k) {
		cout << 1 << endl;
	}
	else if (ma > k) {
		cout << 0 << endl;
	}
	else {
		dfs();
		cout << m1 << endl;
	}
	return 0;
}